package com.whmskj.xjlhsc.mobie.equipmentManage.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.github.xiaoymin.knife4j.annotations.Ignore;
import com.whmskj.xjlhbc.db.DataSource;
import com.whmskj.xjlhbc.db.DataSourceType;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.entity.ACThatDay;
import com.whmskj.xjlhsc.entity.Shachangacrealtime;
import com.whmskj.xjlhsc.mobie.equipmentManage.entity.vo.ACThatDayVo;
import com.whmskj.xjlhsc.service.ACThatDayService;
import com.whmskj.xjlhsc.service.AcRealtimeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 张
 * @version 1.0
 */
@SaIgnore
@RestController
@RequestMapping("/mob/WSD")
@Slf4j
@RequiredArgsConstructor
@Tag(description = "温湿度", name = "温湿度")
@DataSource(DataSourceType.SC)
public class WSDController {

    @Autowired
    private AcRealtimeService acRealtimeService;
    @Autowired
    private ACThatDayService acThatDayService;

        @GetMapping("/acList")
    @Operation(description = "温湿度列表")
    public Result acList(@RequestParam(required = false) String keyWord) {
            Map<String,Object> map = acRealtimeService.acList(keyWord);
      return Result.success(map);
    }

    @GetMapping("/actrend")
    @Operation(description = "温湿度趋势")
    public Result actrend(@RequestParam(required = false) List<Integer> Ids,
                          @RequestParam List<String> Machinenumber,
                          @RequestParam(required = false) String day,
                          @RequestParam(required = false) String startTime,
                          @RequestParam(required = false) String endTime) {
        Map<String, List<ACThatDayVo>> collection = acThatDayService.actrend(Ids,Machinenumber,day,startTime,endTime);
      return Result.success(collection);
    }
}
